/****************************** Module Header ******************************\
 * Module Name:  ExtendMethodForInteger.cs
 * Module Version:  1.0.0 (2011-11-4)
 * Copyright (c) AnyEB.Com (14507247@qq.com)
 * 
 * This class is used to extension Integer value's method.  It supplies 
 * useful extension methods, such as ParseToBoolean().
 * 
 * This source is subject to the GPL License.
 * See http://www.gnu.org/licenses/gpl.html.
 * All other rights reserved.
 * 
 * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, 
 * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED 
 * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
\***************************************************************************/

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace UCF.Core
{
    /// <summary>
    /// 数值的扩展类
    /// <para>提供数值类型的扩展方法，如ParseToBoolean()</para>
    /// </summary>
    public static class ExtendMethodForDecimal
    {

        /// <summary>
        /// 是否在其中
        /// </summary>
        /// <param name="i"></param>
        /// <param name="args"></param>
        /// <returns></returns>
        public static bool IsIn(this Decimal i, params Decimal[] args)
        {
            return args.Contains(i);
        }

        /// <summary>
        /// 获取非空值
        /// </summary>
        /// <param name="i"></param>
        /// <param name="defv"></param>
        /// <returns></returns>
        public static Decimal NotNull(this Decimal? i, Decimal defv)
        {
            return i.HasValue ? i.Value : defv;
        }
    }
}
